<?php

class Zend_View_Helper_Menu extends Zend_View_Helper_Abstract {

    protected $options = array(
        'class' => 'fl',
        'id' => 'menu-top-container',
        'items' => array(),
    );

    public function menu($options = array()) {

        $options = array_merge($this->options, $options);
        $r = '<ul id="' . $options['id'] . '" class="' . $options['class'] . '">';

        foreach ($options['items'] as $key => $item) {
            $item['url'] = $item['url'] == "" ? $this->view->url(array(
                        'module' => 'default',
                        'controller' => 'index',
                        'action' => 'category',
                        'id' => $item['id'],
                            ), 'default', true) : '/'.$item['url'];
            $r .= '<li class="menu-item'.($item['isDefault']==1?' active':'').'">
                <a href="'.$item['url'].'">'.$item['title'].'</a>           
                </li>';
        }

        $r .= '<li class="cls"></li>
            </ul>';

        return $r;
    }

}